package oop3;

/**
 * @author oldliu
 * @since 1.0
 */
//班级
public class Javaclass {
    String name;//名称
    String  dirname;
    Xuesheng[]xs=new Xuesheng[30];
    int count=0;
    public void add(Xuesheng x){
        xs[count++]=x;//没有考虑人满的情况
//        for (int i = 0; i < xs.length; i++) {
//            if(xs[i]==null){
//                xs[i]=x;
//                return;
//            }
//        }
    }
    public void add2(String name,String sex,int age,String shouji){
        xs[count]=new Xuesheng();//!!!!!!!!!!!!!!
        xs[count].name=name;
        xs[count].sex=sex;
        xs[count].age=age;
        xs[count].phone=shouji;
        count++;
    }
    public void show(){
        System.out.println("这个java班级名叫"+name+",指导老师："+dirname);
        for (int i = 0; i < count; i++) {
            xs[i].show();
        }
    }
}
